<?php
//-------------------INPUT ELEMENTS----------------
$product_name = $this->formText('name', $this->Item['name'], array('class' => 'txtmedium'));
$imgAvatar = '';
if (!empty($this->Item['picture'])) {
  $urlAvatar = UPLOADS_URL . '/products/img80x75/' . $this->Item['picture'];
  $imgAvatar = '<br><img src="' . $urlAvatar . '"> <br>' . $this->Item['picture'];
}
$current_picture = $this->formHidden('current_picture', $this->Item['picture']);
$picture = $this->formFile('picture') . $imgAvatar . $current_picture;

$price = $this->formText('price', $this->Item['price'], array('class' => 'txtmedium'));
$selloff = $this->formText('selloff', $this->Item['selloff'], array('class' => 'txtmedium'));

$options = array('Normal', 'Special');
$special = $this->formRadio('special', $this->Item['special'], null, $options, ' ');

$options = array('Inactive', 'Active');
$status = $this->formRadio('status', $this->Item['status'], null, $options, ' ');

$parents = $this->cmsSelect('cat_id', $this->Item['cat_id'], $this->slbCategory, array('size' => 10, 'style' => 'min-width: 200px;'));

$content = $this->cmsReplaceString($this->Item['content']);
$content = $this->cmsEditor('content', $content, array('toolbar' => 'Default', 'language' => 'en'));

$order = $this->formText('order', $this->Item['order'], array('class' => 'txtshort'));
//echo $this->Item['sign'];
$arrInput = array(
            array('label' => 'Product name: ', 'input' => $product_name), 
            array('label' => 'Picture: ', 'input' => $picture, 'style' => 'margin-left: 175px;'), 
            array('label' => 'Price: ', 'input' => $price),
            array('label' => 'Category name: ', 'input' => $parents), 
            array('label' => 'Selloff: ', 'input' => $selloff), 
            array('label' => 'Special: ', 'input' => $special),
            array('label' => 'Status: ', 'input' => $status),
            array('label' => 'Order:', 'input' => $order),
            array('label' => 'Content: ', 'input' => $content, 'style' => 'margin-left:175px;'),
            );
//------------------------MESSAGES ERROR----------------------
$errors = null;
if (count($this->messageError) > 0) {
  $errors = $this->formErrors($this->messageError, array('id' => 'errors'));
}
?>
<form name="appForm" method="post" action="" enctype="multipart/form-data">
  <?php echo $this->render('product/toolbar/index.php') ?>
  <div class="clr"></div>
   <?php // echo $this->render('user/sublink/index.php') ?>
   <?php echo $errors ?>
<!-- BEGIN: CONTENT -->
<div id="element-box">
  <div class="t">
  	<div class="t">
  		<div class="t"></div>
  	</div>
  </div>
  <div class="m">
  	<!-- BEGIN: ELEMENT BOX -->
  	<div id="adminfieldset">
    	<div class="adminheader">Product Details</div>
    	<!-- Area 4: In du lieu lay tu database -->
    	<?php echo $this->partialLoop('row.php', $arrInput); ?>
    	<div class="clr"></div>
    </div>
  	<!-- Area 4: In du lieu lay tu database - End -->
  	<!-- END: ELEMENT BOX -->

  	<div class="clr"></div>
  </div>
  <div class="b">
  	<div class="b">
  		<div class="b"></div>
  	</div>
  </div>
</div>
<!-- END: CONTENT -->
</form>
